<template>
  <div class="plr-box">
    <!-- right -->
    <div class="plr-top">
      <!-- 头部 -->
      <div class="pr-t">
        <span>喜欢这张专辑的人</span>
      </div>
      <!-- 喜欢这个歌单的人 -->
      <div class="pr-img">
        <img
          :src="fans.userProfile.avatarUrl"
          alt=""
          v-for="(fans, index) in fansList"
          :key="index"
          @click="gouserhome(fans.userProfile.userId)"
        />
      </div>
    </div>
    <!-- ta的其他热门专辑 -->
    <div>
      <div class="r-tt">
        <span>Ta的其他热门专辑</span>
        <a href="">其他></a>
      </div>
      <div class="r-but" v-for="hot in hotAlbums" :key="hot.id" @click="goalbumpage(hot.id)">
        <a><img :src="hot.blurPicUrl" alt="" /></a>
        <div class="r-btn-r">
          <p class="btn-name">
            <a>{{ hot.name }}</a>
          </p>
          <p class="btn">
            {{ moment(hot.publishTime).format("YYYY-MM-DD") }}
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import moment from "moment";
import { mapState } from "vuex";
export default {
  name: "RightPlayList",
  data() {
    return {
      id: this.$route.query.id,
      // 推荐歌单
      playlists: [],
      // 收藏者
      subscribers: [],
      moment,
    };
  },
  mounted() {
    this.getRrelatedPlayList();
    this.getArtistFans();
  },
  methods: {
    // 获取歌手的歌单 reqArtistAlbumList
    getRrelatedPlayList() {
      this.$store.dispatch("getRelatedPlayList");
    },

    // 获取歌手粉丝 getArtistFans
    async getArtistFans() {
      this.$store.dispatch("getArtistFans");
    },
    gouserhome(id) {
      // console.log(id)
      this.$router.push(`/userhome?id=${id}`);
    },
    goalbumpage(id) {
      // console.log(id)
      this.$router.push(`/albumpage?id=${id}`);
    },
  },
  computed: {
    ...mapState({
      // 其他专辑
      hotAlbums: (state) => {
        return state.Albumpage.hotAlbums || [];
      },
      // 粉丝
      fansList: (state) => {
        return state.Albumpage.fansList || [];
      },
    }),
  },
};
</script>

<style lang="less" scoped>
.plr-box {
  width: 200px;
  margin: 0 auto;
  .plr-top {
    .pr-t {
      border-bottom: 1px solid rgb(204, 204, 204);
      height: 24px;
      span {
        font-weight: bold;
        font-size: 12px;
        line-height: 24px;
      }
    }
    .pr-img {
      // height: ;
      margin-right: 10px;
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      img {
        margin-top: 10px;
        height: 40px;
        width: 40px;
      }
    }
  }

  .r-tt {
    padding-top: 10px;
    width: 100%;
    height: 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: rgb(204, 204, 204) 1px solid;
    span {
      font-size: 12px;
      font-weight: bold;
    }
    a {
      font-size: 12px;
      color: #666666;
    }
  }
  // 推荐歌单
  .r-but {
    margin-top: 10px;
    display: flex;
    img {
      height: 50px;
      width: 50px;
    }
    .r-btn-r {
      margin-left: 10px;
      display: flex;
      flex-direction: column;
      .btn-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        word-wrap: normal;
        width: 140px;
        a {
          color: #000;
          white-space: nowrap;
          word-wrap: normal;
        }
      }
      .btn {
        margin-top: 5px;
        display: flex;
        span {
          color: #999;
          font-size: 12px;
        }
        a {
          margin-left: 5px;
          width: 106px;
          font-size: 13px;
          color: #666;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          word-wrap: normal;
        }
      }
    }
  }
}
</style>
